package com.shxt.util;

import java.util.List;
import java.util.Map;


public class PageBean {
    public static  Map<String , Object> serverMap(Map<String , Object> map,Object user,Integer pages){
        String t = user.getClass().getSimpleName();
        String type = t.toLowerCase();
        //type就是类的小写名字
        map.put(type , user);
        //pages变化 1,2,3  number变化 0,6,12 从哪个开始
        map.put("number" , (pages-1)*6);
        return map;
    }
    public static  Map<String , Object> map(Map<String , Object> map,Class<?> clazz,List<?> userList,Integer count,int pages){
        String name = clazz.getSimpleName().toLowerCase();
        int sumPage = 1;
        if(count==0){
        	sumPage=1;
        }else{
        	sumPage = (count%6==0)?(count/6):(count/6+1);
        }
        String listType = name+"List";
        map.put(listType , userList);
        map.put("pages" , pages);
        map.put("sumPage" , sumPage);
        return map;

    }
    public static  Map<String , Object> serverMapQ(Map<String , Object> map,Object user,Integer pages){
        String t = user.getClass().getSimpleName();
        String type = t.toLowerCase();
        map.put(type , user);
        map.put("number" , (pages-1)*3);
        return map;
    }
    public static  Map<String , Object> mapQ(Map<String , Object> map,Class<?> clazz,List<?> userList,Integer count,int pages){
        String name = clazz.getSimpleName().toLowerCase();
        int sumPage = 1;
        if(count==0){
        	sumPage=1;
        }else{
        	sumPage = (count%6==3)?(count/3):(count/3+1);
        }
        String listType = name+"List";
        map.put(listType , userList);
        map.put("pages" , pages);
        map.put("sumPage" , sumPage);
        return map;

    }
    
}
